//package com.colorfruit.admin.business.schedule;
//
//import com.colorfruit.admin.business.dao.GlobalProcessionControlMapper;
//import com.colorfruit.admin.pojo.constant.RedisConstant;
//import com.colorfruit.admin.pojo.entity.GlobalProcessionControl;
//import com.colorfruit.admin.pojo.enums.GlobalStatusEnum;
//
//
//import com.colorfruit.framework.redis.RedisCache;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.Date;
//
//@Slf4j
//@Component
//@Transactional
//public class DayDataInitSchedule {
//
//    @Autowired
//    GlobalProcessionControlMapper globalProcessionControlMapper;
//
//    @Autowired
//    RedisCache redisCache;
//
//    @Scheduled(cron = "0 1 0 * * ? ")
//    public void dayDataInit(){
//        try {
//            log.info(" =========================== DayDataInitSchedule start =========================== ");
//            // 1. 初始化当日全局控制状态
//            GlobalProcessionControl globalProcessionControl = new GlobalProcessionControl();
//            globalProcessionControl.setRecordStatus(GlobalStatusEnum.PRE_SALE.getCode());
//            globalProcessionControl.setCreateTime(new Date());
//            globalProcessionControlMapper.insert(globalProcessionControl);
//            //2. 清除首页查询缓存
//            redisCache.deleteCacheWithPattern("*" + RedisConstant.HOME + "*");
//            log.info(" =========================== DayDataInitSchedule end =========================== ");
//        }catch (Exception e){
//            log.error("# [OUT] errorMessage: " + e.getMessage(), e);
//        }
//    }
//
//}
